<template>
  <div>
    <div><h1>退款中</h1></div>
    <div>
      <el-select placeholder="请选择状态"
      v-model="selectedStatus">
        <el-option
          v-for="i in status"
          :key="i.status"
          :label="i.status"
          :value="i.status"
        ></el-option>
      </el-select>
      <el-button type="primary">查询</el-button>
    </div>

    <el-table :data="Refundinglist" style="width: 100%">
      <el-table-column label="订单号" width="150">
        <template slot-scope="scope">
          <i class="code"></i>
          <span style="margin-left: 10px">{{ scope.row.id }}</span>
        </template>
      </el-table-column>

      <el-table-column label="订单日期" width="190">
        <template slot-scope="scope">
          <i class="name"></i>
          <span style="margin-left: 10px">{{ scope.row.name }}</span>
        </template>
      </el-table-column>
      <el-table-column label="客户" width="80">
        <template slot-scope="scope">
          <i class="shortName"></i>
          <span style="margin-left: 10px">{{ scope.row.shortName }}</span>
        </template>
      </el-table-column>
      <el-table-column label="司机" width="80">
        <template slot-scope="scope">
          <i class="shortName"></i>
          <span style="margin-left: 10px">{{ scope.row.shortName }}</span>
        </template>
      </el-table-column>
      <el-table-column label="服务类型" width="130">
        <template slot-scope="scope">
          <i class="Carmodel"></i>
          <span style="margin-left: 10px">{{ scope.row.majorModel }}</span>
        </template>
      </el-table-column>
      <el-table-column label="订单金额" width="90">
        <template slot-scope="scope">
          <i class="discount"></i>
          <span style="margin-left: 10px">{{ scope.row.discount }}</span>
        </template>
      </el-table-column>
      <el-table-column label="退款金额" width="90">
        <template slot-scope="scope">
          <i class="discount"></i>
          <span style="margin-left: 10px">{{ scope.row.discount }}</span>
        </template>
      </el-table-column>
      <el-table-column label="订单状态" width="90">
        <template slot-scope="scope">
          <i class="Carmodel"></i>
          <span style="margin-left: 10px">{{ scope.row.area }}</span>
        </template>
      </el-table-column>
      <el-table-column label="理由" width="140">
        <template slot-scope="scope">
          <i class="discount"></i>
          <span style="margin-left: 10px">{{ scope.row.address }}</span>
        </template>
      </el-table-column>
      <el-table-column label="申请时间" width="150">
        <template slot-scope="scope">
          <i class="Carmodel"></i>
          <span style="margin-left: 10px">{{ scope.row.isSigned }}</span>
        </template>
      </el-table-column>
      <el-table-column label="操作">
        <template slot-scope="scope">
          <el-button size="mini" @click="handleEdit(scope.$index, scope.row)"
            >编辑</el-button
          >
          <el-button
            size="mini"
            type="danger"
            @click="handleDelete(scope.row.id)"
            >删除</el-button
          >
        </template>
      </el-table-column>
    </el-table>
    <el-pagination background layout="prev, pager, next" :total="1000">
    </el-pagination>
  </div>
</template>

<script>
export default {
  created() {
    this.getStatus()
    // 获取订单源
    this.getInit(this.page, this.pageSize);
    //
  },
  data() {
    return {
   selectedStatus:'',
      Refundinglist: [],
      page: 1,
      pageSize: 10,
      status:''
    };
  },
  methods: {
    getStatus(){
       this.$http({
        url: "/refund/getAllStatus",
        method: "GET"
      })
        .then((res) => {
          console.log(res.data.data);
          this.status = res.data.data;
          this.selectedStatus=this.status[0].status
        })
        .catch((err) => {
          console.log("订单来源数据获取失败", err);
        });
    },
    handleEdit(index, row) {
      console.log(index, row);
    },
    handleDelete(index, row) {
      console.log(index, row);
    },
    getInit(page, pageSize) {
      this.$http({
        url: "/refund/selectAllByPage",
        method: "GET",
        data: {
          page,
          pageSize,
        },
      })
        .then((res) => {
          console.log(res.data.data);
          this.Refundinglist = res.data.data;
        })
        .catch((err) => {
          console.log("订单来源数据获取失败", err);
        });
    },
  },
};
</script>